<!DOCTYPE html>
<html>
  <head>
    <title>XMLHttpRequest: open() - allowed case in/sensitive methods test</title>
    <script src="../resources/testharness.js"></script>
    <script src="../resources/testharnessreport.js"></script>
  </head>
  <body>
    <p style="visibility: hidden;">Valid methods per step-5 of https://xhr.spec.whatwg.org/#the-open()-method.</p>
    <script type="text/javascript">
      function testMethod(methodName) {
        var client = new XMLHttpRequest();
        client.open(methodName, "resources/echo-request-method.php");
        client.onreadystatechange = function(event) {
          if (event.target.readyState == 4)
            assert_equals(client.getResponseHeader("x-custom-request-method"), methodName.toUpperCase());
        }
        client.send(null);
      }

      test(function() { testMethod("PUT"); });
      test(function() { testMethod("Put"); });
      test(function() { testMethod("DELETE"); });
      test(function() { testMethod("DeLeTe"); });
      test(function() { testMethod("HEAD"); });
      test(function() { testMethod("hEAd"); });
      test(function() { testMethod("OPTIONS"); });
      test(function() { testMethod("OPtiOns"); });
      test(function() { testMethod("POST"); });
      test(function() { testMethod("post"); });
      test(function() { testMethod("GET"); });
      test(function() { testMethod("gEt"); });
    </script>
  </body>
</html>

